<%@ include file = "/common/ini.jsp"%>
<%@ include file = "/common/_log4j.jsp"%>
<%@ include file = "/common/_ApplicationContext_init.jsp"%>
<%@ include file = "/common/_vr.jsp"%>
<%@ include file = "/js/_js_for_select.jsp"%>
<%
    // 定义名称
    String title = "新增角色";
    String remark = "";
%>
<script>
    function submitData()
    {
        detailForm.serviceURL.value = "sysframe.role.NewRoleService";
        if(detailForm.parentId.value == "null")
        {
            detailForm.parentId.disabled = true;
        }
        detailForm.submit();
    }
    function reset()
    {
        <%
        String parentId = null;
        if(request.getParameter("parentId") != null)
        {
            RoleManager roleManager = (RoleManager)applicationContext.getBean("roleManager");
            Role superRole = (Role)roleManager.get(request.getParameter("parentId"));
            parentId = superRole.getId();
            %>addOption(detailForm.parentId,"<%= superRole.getId()%>","<%= superRole.getName()%>");<%
        }
        if(vr.isAllValidated())
        {
            %>
            detailForm.code.value = "";
            detailForm.parentId.value = "<%= parentId%>";
            detailForm.name.value = "";
            <%
        }
        else
        {
            %>
            detailForm.code.value = "<%= request.getParameter("code")%>";
            detailForm.parentId.value = "<%= request.getParameter("parentId")%>";
            detailForm.name.value = "<%= request.getParameter("name")%>";
            <%
            remark = request.getParameter("remark");
        }
        %>
    }

    function bodyLoadJS()
    {
        // 被聚焦的控件
        detailForm.code.focus();
    }
</script>
<%@ include file = "/common/detail/_OnForm.jsp"%>
<%@ include file = "_detail.jsp"%>
<%@ include file = "/common/detail/_UnderFom_OnButton.jsp"%>
          <input  type="button" value="提交" afterFocused="" of="true" onclick="submitData()">
          &nbsp;&nbsp;<input  type="button" onclick="reset()" value="重置">
          &nbsp;&nbsp;<input  type="button" onclick="goback()" value="返回">
<%@ include file = "/common/detail/_UnderFom_underButton.jsp"%>

